package com.qf.openapi.web.master.dao;

import com.qf.openapi.web.master.entity.User;
import com.qf.openapi.web.master.vo.UserVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

public interface UserDao {

    public User getUserById(Integer id);


    public User getUserByIdAndPassword(@Param("id") Integer id, @Param("pwd") String password);


    public User selectUserByIdAndPwd_map(Map map);


    public User selectUserByUserInfo(User user);


    public List<User> selectUsersByName(@Param("name") String name);


    public Integer deleteUserByid(@Param("id") Integer id);


    public Integer updateUser(User user);

    public Integer insertUser(User user);


    // 选择所有没有被点名的同学
    public List<User> getAllUnPickedUsers();

    // 把sex重置为0
    public Integer resetUsers();


    //  演示 sql 注入问题
    public List<User> selectUsersByKeyword(@Param("name") String name);


    // 演示 $ 的使用场景
    public List<User> selectUserByidwithOrder(@Param("order") String order);

    // 查询所有用户,带分页条件
    public List<User> getAllUserByPage(Integer start, Integer size);


    // 查询所有使用后
    public List<User> getAllUser();

    // 测试让myslq数据库休眠
    public void sleep();

    User getUserByNameAndPassword( String username,String password );


    User getUserByName( String username);


	Integer getCount( );

    List< User> getUsers( @Param("start") Integer start,@Param("limit")Integer limit );

	Integer deleteUserByName( String name );

	@Transactional(rollbackFor=Exception.class)
	Integer deleteUsers( int[] arr );

    List< User> getUsersByContdition(  UserVo userVo );
}
